/**
 * 
 */
package stc.skymobi.bean.kv.codec;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.junit.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import stc.skymobi.bean.kv.codec.Urlencoded2KV;

/**
 * @author hp
 *
 */
public class Urlencoded2KVTestCase {

	/**
	 * @throws java.lang.Exception
	 */
	@Before
	public void setUp() throws Exception {
	}

	/**
	 * @throws java.lang.Exception
	 */
	@After
	public void tearDown() throws Exception {
	}

	/**
	 * Test method for {@link stc.skymobi.bean.kv.codec.Urlencoded2KV#transform(java.lang.String)}.
	 */
	@Test
	public void testTransform() {
		Urlencoded2KV	trans = new Urlencoded2KV();
		Map<String, List<String>> ret = trans.transform("hsman=skytest&hstype=m900&hswidth=240&hsheight=320&hsplat=mtk&version=153");
		
		Map<String, List<String>> match = new HashMap<String, List<String>>();
		match.put("hsman", Arrays.asList( new String[]{"skytest"} ) );
		match.put("hstype", Arrays.asList( new String[]{"m900"} ) );
		match.put("hswidth", Arrays.asList( new String[]{"240"} ) );
		match.put("hsheight", Arrays.asList( new String[]{"320"} ) );
		match.put("hsplat", Arrays.asList( new String[]{"mtk"} ) );
		match.put("version", Arrays.asList( new String[]{"153"} ) );

		Assert.assertEquals(ret, match);
	}

}
